<template>
    <rx-dialog @handOk="handleSubmit" @cancel="cancel">
        <rx-layout>
            <div slot="center" style>
                <rx-fit>
                    <div slot="toolheader" foldheader="true" foldbtn="true" border="false">
                        <div class="table-page-search-wrapper">
                            <a-form layout="inline">
                                <a-row :gutter="24">
                                    <a-col :span="8">
                                        <a-form-item :label="i18n('formReport.reportName','报表名称')">
                                            <a-input :placeholder="i18n('formReport.reportName','报表名称','input')" v-model="queryParam['Q_NAME__S_LK']"/>
                                        </a-form-item>
                                    </a-col>
                                    <template v-if="advanced">

                                    </template>
                                    <a-col :md="8" :sm="24">
              <span class="table-page-search-submitButtons">
                <a-button @click="$refs.table.loadData()" icon="search" type="primary">{{$ti18('rxList.searchBtn','查询')}}</a-button>
                <a-button @click="resetSearch" style="margin-left: 4px">{{$ti18('rxList.resetBtn','重置')}}</a-button>
                <a @click="toggleAdvanced" style="margin-left: 8px">
                  {{ advanced ? $ti18('rxList.putAwayBtn','收起') : $ti18('rxList.openBtn','展开') }}
                  <a-icon :type="advanced ? 'up' : 'down'"/>
                </a>
              </span>
                                    </a-col>
                                </a-row>
                            </a-form>
                        </div>

                    </div>
                    <rx-grid
                        ref="table"
                        :allowRowSelect="true"
                        :multiSelect="false"
                        :columns="columns"
                        :defaultPageSize="10"
                        url="/api-ureport/ureport2/core/ureportFile/query"
                        :queryParam="queryParam"
                        data-field="result.data"
                        :pageSizeOptions="['10','30','40']"
                        id-field="id"
                        @selectChange="onSelectChange"
                    >

                    </rx-grid>
                </rx-fit>
            </div>
        </rx-layout>
    </rx-dialog>
</template>

<script>
    import {BaseList, RxFit, RxGrid, Util} from "@lowcode/jpaas-common-lib";

    export default {
        name: 'FormReportDialog',
        mixins: [BaseList],
        components: {
            RxFit
        },
        props: {
            layerid: {
                type: String,
                default: ""
            },
            destroy: {
                type: Function
            },
        },
        data() {
            return {
                columns: [
                    {
                        title: this.$ti18('rxList.index','序号'),
                        type: 'indexColumn',
                        width: 50,
                        dataIndex: 'serial',
                        scopedSlots: {customRender: 'serial'}
                    },
                    {title: this.i18n('formReport.reportName','报表名称'), dataIndex: 'name', width: 200},
                    {title: this.$ti18('rxForm.createTime','创建时间'), dataIndex: 'createTime', width: 100}
                ]
            }
        },
        methods: {
            i18n(name,text,key){
                return this.$ti18(name,text,"formBoList",key);
            },
            handleSubmit(vm) {
                if(this.selectedRows.length==0){
                    this.$message.warning(this.i18n('formReport.selectedRows','请选择至少一个'));
                    vm.loading=false;
                    return;
                }
                Util.closeWindow(this,"ok",this.selectedRows[0])
            },
            cancel() {
                Util.closeWindow(this,"cancel")
            },
        }
    }
</script>
<style scoped>

</style>

